Ext.define('extjs6test.view.base.BaseGridController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.basegridcontroller',
    onGridAfterlayout: function (g, layout, opts) {
        var gridHeaderHeight = g.getColumns()[0].getHeight(); //表格列头高度
        // console.debug("gridHeaderHeight = " + gridHeaderHeight+"," +
        //     "g.getHeight() = "+g.getHeight()+"," +
        //     "g.down('[dock=top]').getHeight() = "+g.down('[dock=top]').getHeight()+"," +
        //     "g.down('[dock=bottom]').getHeight() = "+g.down('[dock=bottom]').getHeight());

        var pagesize = Math.ceil(
            (
                g.getHeight()
                - g.down('[dock=top]').getHeight() - g.down('[dock=bottom]').getHeight()
                - gridHeaderHeight
            )
            /
            gridHeaderHeight
        );
        console.debug("BaseGrid PageSize is " + pagesize);
        if (pagesize < g.minPageSize)
            pagesize = g.minPageSize;
        g.getStore().setPageSize(pagesize);
        g.getStore().getProxy().setExtraParam(g.getStore().getProxy().getLimitParam(), pagesize);
    }
});